/**
 * 
 */
package server;

import gui.AccountStruct;

import java.io.IOException;
import java.io.InputStream;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.io.OutputStream;
import java.net.ServerSocket;
import java.net.Socket;
import java.util.List;

import model.Model;

/**
 * @author Administrator
 *
 */
public class ConnectThread extends Thread{
	private ServerSocket _ss;
	private Model _model;
	private List<AccountStruct> _accounts;
	public ConnectThread(ServerSocket ss, Model model, List<AccountStruct> accounts) {
		this._model = model;
		this._ss = ss;
		this._accounts = accounts;
	}
	@Override
	public void run() {
		while (true) {
			Socket s;
			try {
				System.out.println("Wait client");
				s = _ss.accept();				
				ListenThread lt = new ListenThread(s, _model, _accounts);
				lt.start();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}			
		}
	}
}
